package com.owc.common.enums;

import java.util.Arrays;
import java.util.Optional;

/**
 * @Author xiaom
 * @Date 2019/12/9 11:56
 * @Version 1.0.0
 * @Description <>
 **/
public enum ModifyEnum {
    LOGIN_PWD(1,"登录密码"),
    PAY_PWD(2,"支付密码");

    private Integer type;

    private String desc;

    ModifyEnum(Integer type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    public Integer getType() {
        return type;
    }

    public String getDesc() {
        return desc;
    }

    /**
     * Find client enum by client type.
     * @param type type
     * @return Client enum example.
     */
    public static Optional<ModifyEnum> match(Integer type) {
        return Arrays.stream(ModifyEnum.values())
                .filter(t -> t.getType().equals(type))
                .findFirst();
    }
}
